package com.hdsx.netty.tomcatserver;

import java.nio.IntBuffer;

/**
 * @author 占贤银
 * time 2024/7/31 20:42
 * description 生命之灯因热情而点燃，生命之舟因拼搏而前行
 */
public class IntBufferDemo {

    public static void main(String[] args) {
        IntBuffer intBuffer = IntBuffer.allocate(8);
        System.out.println("limit = " + intBuffer.limit());
        System.out.println("capacity = " + intBuffer.capacity());
        System.out.println("position = " + intBuffer.position());
        for (int i = 0; i < intBuffer.capacity(); i++) {
            intBuffer.put(2 * (1 + i));
        }
        intBuffer.flip();

        System.out.println("limit = " + intBuffer.limit());
        System.out.println("capacity = " + intBuffer.capacity());
        System.out.println("position = " + intBuffer.position());
    }
}
